package com.serialization.demo3;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.ArrayList;
import java.util.List;

import com.serialization.demo1.Worm;

/**
 * 保存对象状态
 * 
 * @author Administrator
 *
 */
public class ReadTest {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) throws FileNotFoundException,
			IOException, ClassNotFoundException {
		ObjectInputStream in = new ObjectInputStream(new FileInputStream(
				"cad.out"));
		List<Class<? extends Shape>> shapeTypes2 = (List<Class<? extends Shape>>) in
				.readObject();
		List<Shape> shapes2 = (List<Shape>) in.readObject();
		System.out.println(shapes2);
	}

}
